package com.hbxx.lotteryapp.controller;

import com.hbxx.lotteryapp.commons.Result;
import com.hbxx.lotteryapp.service.IWxUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author crush
 * @since 2021-09-14
 */
@Slf4j
@RestController
@RequestMapping("/wxUser")
@CrossOrigin
public class WxUserController {
    @Resource
    private IWxUserService wxUserService;

    /**
     * 微信小程序授权登录
     * @param code
     * @return
     */
    @GetMapping("/authLogin/{code}")
    public Result authLogin(@PathVariable("code") String code){
        return  wxUserService.authLogin(code);
    }


    /**
     * 我的>个人中心用户信息
     * @param request
     * @return
     */
    @GetMapping("/userInfo")
    public Result userInfo(HttpServletRequest request){
        return wxUserService.userInfo(request);
    }
}

